package com.d0325;

import com.d0326.Student;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class TestArrayList {
    public static void main(String[] args) {
        List<Integer> myList = new ArrayList<Integer>();
        myList.add(0,11);
        myList.add(1,12);
        myList.add(2,13);
        myList.add(1,23);
        myList.add(44);
        System.out.println(myList.isEmpty());
        //System.out.println(myList.contains(2));
        //myList.remove(3);
        System.out.println("元素的个数:"+myList.size());
        System.out.println(myList.get(1));
        //移出列表指定位置的元素
        myList.remove(2);
        System.out.println("元素的个数:"+myList.size());
        //返回列表1（包括）-4（不包括）这个区间的部分
        System.out.println(myList.subList(1,4)+"\t");

        Iterator<Integer> iterator=myList.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }

    }
}
